package mapper;

import DO.PPTDO;
import VO.ChapterVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PPTMapper {

    // 保存课件
    @Insert("insert into ppt (class_id, address, ppt_name, chapter_id) VALUES " +
            "(#{classId},#{address},#{pptName},#{chapterId})")
    void save(PPTDO pptdo);

    // 根据班级id查询出全部课件数据
    @Select("select * from ppt where class_id = #{classId} order by chapter_id")
    List<PPTDO> selectByClassId(Integer ClassId);

    // 根据id获取地址信息
    @Select("select address from ppt where id = #{id}")
    String getAddress(Integer id);

    // 删除课件
    @Delete("delete from ppt where id = #{id}")
    Integer deletePPT(Integer id);
}
